package com.huaju.enity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * Notice entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "notice", catalog = "licai")
public class Notice implements java.io.Serializable {

	// Fields

	private Integer nid;
	private Account account;
	private Ntype ntype;
	private Date ntime;
	private String ncontent;
	private String nauthor;
	private String ntitle;
	private Integer isRead;

	// Constructors

	/** default constructor */
	public Notice() {
	}

	/** full constructor */
	public Notice(Account account, Ntype ntype, Date ntime,
			String ncontent, String nauthor, String ntitle, Integer isRead) {
		this.account = account;
		this.ntype = ntype;
		this.ntime = ntime;
		this.ncontent = ncontent;
		this.nauthor = nauthor;
		this.ntitle = ntitle;
		this.isRead = isRead;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "nid", unique = true, nullable = false)
	public Integer getNid() {
		return this.nid;
	}

	public void setNid(Integer nid) {
		this.nid = nid;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "aid")
	public Account getAccount() {
		return this.account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "tid")
	public Ntype getNtype() {
		return this.ntype;
	}

	public void setNtype(Ntype ntype) {
		this.ntype = ntype;
	}

	@Column(name = "ntime", length = 19)
    @DateTimeFormat(pattern="yyyy-MM-dd" ) 
    @JsonFormat(pattern="yyyy-MM-dd" ,timezone = "GMT+8")
	public Date getNtime() {
		return this.ntime;
	}

	public void setNtime(Date ntime) {
		this.ntime = ntime;
	}

	@Column(name = "ncontent")
	public String getNcontent() {
		return this.ncontent;
	}

	public void setNcontent(String ncontent) {
		this.ncontent = ncontent;
	}

	@Column(name = "nauthor")
	public String getNauthor() {
		return this.nauthor;
	}

	public void setNauthor(String nauthor) {
		this.nauthor = nauthor;
	}

	@Column(name = "ntitle")
	public String getNtitle() {
		return this.ntitle;
	}

	public void setNtitle(String ntitle) {
		this.ntitle = ntitle;
	}

	@Column(name = "isRead")
	public Integer getIsRead() {
		return this.isRead;
	}

	public void setIsRead(Integer isRead) {
		this.isRead = isRead;
	}

}